package com.hl.controller;

import com.hl.domain.Charge;
import com.hl.service.serviceImpl.ChargeServiceImpl;
import com.hl.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author：王祖威
 * @Date ：2024/9/10 17:30
 */
@RestController
@RequestMapping("/charge")
public class ChargeController {
    @Autowired
    private ChargeServiceImpl chargeServiceImpl;

    @GetMapping("/find")
    public R findAll(){
        return R.success(chargeServiceImpl.findAll());
    }

    @PostMapping("/add")
    public R add(Charge record){
        return R.success(chargeServiceImpl.insertSelective(record));
    }

    @PutMapping("/updata")
    public R update(Charge record){
        return R.success(chargeServiceImpl.updateByPrimaryKeySelective(record));
    }

    @DeleteMapping("/delete")
    public R del(Long id){
        return R.success(chargeServiceImpl.deleteByPrimaryKey(id));
    }

    @GetMapping("/findlike")
    public R findlike(String name){
        return R.success(chargeServiceImpl.findlike(name));
    }




}
